{% extends 'generic/object_detail.html' %}
{% load helpers %}
{% load static %}

{% block extra_breadcrumbs %}
                <li><a href="{{ object.rack.get_absolute_url }}">{{ object.rack }}</a></li>
{% endblock extra_breadcrumbs %}

{% block content_left_page %}
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Rack</strong>
            </div>
            <table class="table table-hover panel-body attr-table">
                {% with rack=object.rack %}
                    <tr>
                        <td>Site</td>
                        <td>
                            {% if rack.site.region %}
                                <a href="{{ rack.site.region.get_absolute_url }}">{{ rack.site.region }}</a> /
                            {% endif %}
                            <a href="{% url 'dcim:site' slug=rack.site.slug %}">{{ rack.site }}</a>
                        </td>
                    </tr>
                    <tr>
                        <td>Group</td>
                        <td>
                            {% if rack.group %}
                                <a href="{% url 'dcim:rack_list' %}?site={{ rack.site.slug }}&group={{ rack.group.slug }}">{{ rack.group }}</a>
                            {% else %}
                                <span class="text-muted">None</span>
                            {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <td>Rack</td>
                        <td>
                            <a href="{{ rack.get_absolute_url }}">{{ rack }}</a>
                        </td>
                    </tr>
                {% endwith %}
            </table>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Reservation Details</strong>
            </div>
            <table class="table table-hover panel-body attr-table">
                <tr>
                    <td>Units</td>
                    <td>{{ object.unit_list }}</td>
                </tr>
                <tr>
                    <td>Tenant</td>
                    <td>
                        {% if object.tenant %}
                            {% if object.tenant.group %}
                                <a href="{{ object.tenant.group.get_absolute_url }}">{{ object.tenant.group }}</a> /
                            {% endif %}
                            <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>User</td>
                    <td>{{ object.user }}</td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td>{{ object.description }}</td>
                </tr>
            </table>
        </div>
{% endblock content_left_page %}

{% block content_right_page %}
        <div class="row" style="margin-bottom: 20px">
            <div class="col-md-6 col-sm-6 col-xs-12">
                <div class="rack_header">
                    <h4>Front</h4>
                </div>
                {% include 'dcim/inc/rack_elevation.html' with object=object.rack face='front' %}
            </div>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <div class="rack_header">
                    <h4>Rear</h4>
                </div>
                {% include 'dcim/inc/rack_elevation.html' with object=object.rack face='rear' %}
            </div>
        </div>
{% endblock content_right_page %}

{% block javascript %}
    <script src="{% static 'js/rack_elevations.js' %}?v{{ settings.VERSION }}"></script>
{% endblock javascript %}
